import Vue from 'vue'
import Router from 'vue-router'
// import index from '@/view/index'
// import RealFault from "@/view/RealFault"
// import FaultHistory from "@/view/FaultHistory"
import HomePage from "@/view/customer"
// import CommonIframe from "@/view/CommonIframe"
import agent from "@/view/agent"
import deformity from "@/view/deformity"
import orders from "@/view/orders"

Vue.use(Router)
// 重写vue的router的push和replace方法，让我们可以点击同一个路由的时候，可以重新请求
// push
const VueRouterPush = Router.prototype.push 
Router.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}
//replace
const VueRouterReplace = Router.prototype.replace
Router.prototype.replace = function replace (to) {
  return VueRouterReplace.call(this, to).catch(err => err)
}
const router = new Router({
  routes: [
    {
      path: '/',
      name: 'index',
      component: HomePage,
    },
    {
      path: '/agent',
      name: 'agent',
      component: agent,
    },
    {
      path: '/deformity',
      name: 'deformity',
      component: deformity,
    },
    {
      path: '/orders',
      name: 'orders',
      component: orders,
    },
    // {
    //   path: '/HomePage',
    //   name: 'HomePage',
    //   component: HomePage,
    // },
  ]
})

export default router;
